package top.forgirl.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import top.forgirl.common.group.Insert;
import top.forgirl.common.group.Update;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

@Getter
@Setter
@ToString
@ApiModel("需求记录模型POJO")
public class Demand {

    @JsonIgnore
    private Integer id;
    @JsonIgnore
    private Integer deletedFlag;
    @JsonIgnore
    private LocalDateTime updateTime;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
    @ApiModelProperty("公司代号")
    @NotBlank(message = "公司代号不能为空及空串", groups = {Insert.class, Update.class})
    private String cId;
    @ApiModelProperty("需求物品代号")
    @NotBlank(message = "物品代号不能为空或空串", groups = {Insert.class, Update.class})
    private String dId;
    @ApiModelProperty("需求物品数量")
    @Min(value = 0, message = "数量不能为负数", groups = {Insert.class, Update.class})
    @NotNull(message = "数量不能为空", groups = {Insert.class})
    private Integer number;
    @ApiModelProperty("是否包含运费")
    private Integer containCostFlag;
    @ApiModelProperty("截至日期")
    @NotNull(message = "截至日期不能为空", groups = {Insert.class})
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime deadline;
    @ApiModelProperty("目的地")
    private String toLocation;
}
